<?php
/**
 * myPagerHelper.php
 */
function pagination($pager,$uri) 
{ 
    $html = ''; 
  
    if ($pager->haveToPaginate()) 
    { 
        $uri .= strstr($uri, '?') ? '&page=' : '?page='; 
  
        if ($pager->getPage() != 1) 
        { 
            $html .= '<li>' . link_to('first', $uri . '1') . '</li>'; 
            $html .= '<li>' . link_to('previous', $uri . $pager->getPreviousPage()) . '</li>'; 
        } 
  
        foreach ($pager->getLinks() as $page) 
        { 
            if ($page == $pager->getPage()) 
                $html .= '<li><strong>' . link_to($page, $uri . $page) . '</strong></li>'; 
            else 
                $html .= '<li>' . link_to($page, $uri . $page) . '</li>'; 
        } 
  
        if ($pager->getPage() != $pager->getLastPage()) 
        { 
            $html .= '<li>' . link_to('next', $uri . $pager->getNextPage()) . '</li>'; 
            $html .= '<li>' . link_to('last', $uri . $pager->getLastPage()) . '</li>'; 
        } 
  
        $html = '<ul class="pagination">' . $html . '</ul>'; 
    } 
  
    return $html; 
} 